package com.wyw.hemerocallis.repository;

import com.wyw.hemerocallis.entity.HemerocallisOrder;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

/**
 * HemerocallisOrder repository接口
 *
 * @author Mr Wu    yewen.wu.china@gmail.com
 * <p>
 * Update History:
 * Author        Time            Content
 */
@Repository
public interface HemerocallisOrderRepository extends PagingAndSortingRepository<HemerocallisOrder, Long> {

    /**
     * 根据userId查询分页订单
     * @param userId    用户ID
     * @param pageable  分页信息
     * @return
     * select * from hemerocallis_order where user_id = ? order by ... desc/asc limit x offset y
     */
    Page<HemerocallisOrder> findAllByUserId(Long userId, Pageable pageable);

}
